﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers.world {
    import net.wooga.pets.loading.vos.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.constants.*;
    import org.robotlegs.mvcs.*;

    public class LoadNewPatientCommand extends Command {

        public var event:InfoEvent;

        override public function execute():void{
            var _local1:Object = {disease:this.event.info.disease_id};
            var _local2:String = ((this.event.info.pet_type + "_") + this.event.info.disease_name);
            var _local3:RequestEvent = new RequestEvent(EventConstants.SEND_REQUEST, this.onResult);
            _local3.addRequest("select_patient", _local1);
            _local3.addAssetRequest(ProtocolConstants.LOAD_PATIENT, _local2.toLowerCase());
            dispatch(_local3);
        }
        private function onResult(_arg1:ResultVO):void{
            var _local2:Object;
            if (_arg1.success){
                _local2 = _arg1.data.select_patient;
                dispatch(new InfoEvent(EventConstants.START_IN_VILLAGE, _local2[ProtocolConstants.ID], _local2));
            };
        }

    }
}//package net.wooga.pets.controllers.world 
